﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class admin_contact_contact : System.Web.UI.Page
{
    public int ContactId
    {
        get;
        set;
    }

    private Label[] phoneLabelArray;
    private Label[] faxLabelArray;
    protected void Page_Load(object sender, EventArgs e)
    {
        phoneLabelArray = new Label[] {phoneLabel1,phoneLabel2,phoneLabel3 };
        faxLabelArray = new Label[] {faxLabel1,faxLabel2,faxLabel3};
        DB db = new DB();
        Contact contact = db.getContact(0);//这里的参数是随便传递的
        //判断是否还没有输入任何联系地址
        if (contact == null)
            return;
        addressLabel_cn.Text = contact.Address_cn;
        addressLabel_en.Text = contact.Address_en;
        postcodeLabel.Text = Convert.ToString(contact.PostCode);
        for (int i = 0; i < contact.PhoneNumber.Count; ++i)
        {
            phoneLabelArray[i].Text = contact.PhoneNumber[i];
        }
        for (int j = 0; j < contact.Fax.Count; ++j)
        {
            faxLabelArray[j].Text = contact.Fax[j];
        }
        emailLabel.Text = contact.Email;
        ContactId = contact.ContactId;
    }
    protected void editButton_Click(object sender, EventArgs e)
    {
        Server.Transfer("modifycontact.aspx");
    }
}
